package com.myhouse.common.utils.myquartz.config;


import com.myhouse.application.job.config.TestQuartzConfig;
import com.myhouse.application.job.job.TestJob;
import com.myhouse.common.utils.myquartz.utils.QuartzUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Configuration;

/**
 * 启动时运行
 * @author 章瑜亮
 */
@Configuration
public class Autorunner implements ApplicationRunner {

    /**
     * quartzUtil
     */
    @Autowired
    private QuartzUtil quartzUtil;

    /**
     * 配置
     */
    @Autowired
    private TestQuartzConfig testQuartzConfig;

    /**
     * 启动时运行
     * @param args
     * @throws Exception
     */
    @Override
    public void run(ApplicationArguments args) throws Exception {
        quartzUtil.addAndExecute(
                TestJob.class,null,testQuartzConfig,null
        );
    }
}
